const express = require("express");
const { createCommentService, deleteCommentService, getCommentPagingService } = require("../service/commentService");
const router = express.Router();

// 分页获取评论
router.get("/", async (req, res, next) => {
    res.send(await getCommentPagingService(req.query));
})

// 删除评论
router.delete("/:id", async (req, res, next) => {
    res.send(await deleteCommentService(req.params.id));
})

// 新增评论
router.post("/", async (req, res, next) => {
    res.send(await createCommentService(req.body))
})

module.exports = router;